<div id="content">
    <div class="container">
        <div id="main">
            <?php if( $query ): foreach($query as $post): ?>
                <div class="entry">
                    <div class="entry-header">
                        <h2><a href="<?php echo base_url() . 'front/blog/post/' . $post->entry_id; ?>"><?php echo ucwords($post->entry_name); ?></a></h2>
                        <?php echo lang('posteado_por');?>&nbsp;
                        <a href="#"><?php echo ucfirst($post->username);?></a>
                        &nbsp;|&nbsp;
                        <span class="date"><?php echo mdate('%n %M %Y %H:%i:%s', human_to_unix($post->entry_date)); ?></span>
                    </div><!-- end .entry-header -->
                    <div class="entry-content">
                        <?php echo $post->entry_body; ?>
                    </div><!-- end .entry-content -->
                    <div class="box-footer">
                        <div class="align-left">
                            <ul>
                                <li><strong>Category:</strong>&nbsp;&nbsp;</li>
                                <?php $item = $this->blog_model->get_related_categories($post->entry_id);
                                foreach ($item as $category): ?>
                                    <li><a href="<?php echo site_url('category/'.$category->slug); ?>"><?php echo $category->category_name; ?></a>&nbsp;</li>
                                <?php endforeach; ?>
                            </ul>
                        </div><!-- end .align-left -->
                    </div><!-- end .box-footer -->                
                </div><!-- end .entry -->
                <div id="comments">
                    <div class="box-header">
                        <div class="align-left">
                            <span class="comments-count">
                                <em>
                                    &nbsp;&nbsp;<?php echo ($post->comment_count > 99 ? $post->comment_count : $post->comment_count."&nbsp;");?>
                                </em>
                            </span> 
                            <h6><?php echo lang('comentarios');?></h6>
                        </div>
                        <div class="align-right">
                            <?php if($this->session->userdata('idusuario') != ''){?>
                                <strong><a href="#respond">+<?php echo lang('comenta_esta_entrada');?></a></strong>
                            <?php }?>
                        </div>
                    </div>

                    <?php $this->load->view($ruta_template['ruta_archivos'] . 'blog/comment'); ?>

                </div><!-- #comments -->

                <?php echo $this->pagination->create_links();?>
                <?php if(validation_errors()){echo validation_errors('<p class="error">','</p>');} ?>
                <?php if($this->ion_auth->logged_in()){?>
                    <div id="respond" class="box">
                    <div class="box-header">
                        <h6 class="align-left"><?php echo lang('dejanos_un')." ";?><span><?php echo lang('comentario');?></h6>
                    </div>
                    <form method="post" action="<?php echo site_url('front/blog/add_comment');?>" id="comment-form" class="form clearfix">
                        <input type="hidden" name="p_post" value="<?php echo $post_id;?>"/>
                        <div class="input_block">
                            <p>
                                <label for="name"><?php echo lang('nombre')." ";?><span>(<?php echo lang('obligatorio');?>)</span></label>
                                <input type="text" name="p_name" id="p_name" class="input" value="">
                            </p>
                            <p>
                                <label for="email"><?php echo lang('email')." ";?><span>(<?php echo lang('obligatorio');?>)</span></label>
                                <input type="text" name="p_email" id="p_email" class="input" value="">
                            </p>
                            <p>
                                <label for="website"><?php echo lang('pagina_web')." ";?><span>(<?php echo lang('opcional');?>)</span></label>
                                <input type="text" name="p_website" id="p_website" class="input" value="">
                            </p>
                        </div>
                        <div class="textarea_block">
                            <p>
                                <label for="comment"><?php echo lang('comentarios');?></label>
                                <textarea id="comment" name="p_comment" rows="10" cols="45" class="input"></textarea>
                            </p>
                            <p>
                                <input type="submit" name="submit" value="<?php echo lang('enviar');?>" class="submit" />
                            </p>
                        </div>
                    </form>
                </div><!-- end #respond -->
                <?php }?>
            <?php endforeach; else: ?>
                <h2>No post yet!</h2>
            <?php endif;?>


        </div><!-- end #main -->
        <?php include 'menu_sidebar.php';?>
        <div class="clear"></div>
    </div><!-- end .container -->
</div><!-- end #content -->